package cz.zcu.fav.ratdroid.bean;

import java.io.Serializable;

import org.simpleframework.xml.Element;
import org.simpleframework.xml.Root;

@Root(name="object")
public class Object implements Serializable
{
	public static String SINGLE_OBJECT_IDENTIFIER = "object.identifier";
	private static final long serialVersionUID = 8547831055860004175L;
	
	@Element(name="id")
	private Integer id;
    @Element(name="description")
	private String description;
    @Element(name="identifier")
    private String identifier;
    @Element(name="name")
    private String name;
    @Element(name="objectClassName")
    private String objectClassName;
    @Element(name="objectclassId")
    private Integer objectClassId;
    @Element(name="favourite")
    private boolean favourite;
    @Element(name="pickable")
	private boolean pickable;
    @Element(name="returnable")
	private boolean returnable;
	public Integer getId()
	{
		return id;	
	}
	public void setId(Integer id)
	{
		this.id = id;
	}
	public String getDescription()
	{
		return description;
	}
	public void setDescription(String description)
	{
		this.description = description;
	}
	public String getIdentifier()
	{
		return identifier;
	}
	public void setIdentifier(String identifier)
	{
		this.identifier = identifier;
	}
	public String getName()
	{
		return name;
	}
	public void setName(String name)
	{
		this.name = name;
	}
	public String getObjectClassName()
	{
		return objectClassName;
	}
	public void setObjectClassName(String objectClassName)
	{
		this.objectClassName = objectClassName;
	}
	public Integer getObjectClassId()
	{
		return objectClassId;
	}
	public void setObjectClassId(Integer objectClassId)
	{
		this.objectClassId = objectClassId;
	}
	
	public boolean isFavourite()
	{
		return favourite;
	}
	public void setFavourite(boolean favourite)
	{
		this.favourite = favourite;
	}
	public boolean isPickable()
	{
		return pickable;
	}
	public void setPickable(boolean pickable)
	{
		this.pickable = pickable;
	}
	public boolean isReturnable()
	{
		return returnable;
	}
	public void setReturnable(boolean returnable)
	{
		this.returnable = returnable;
	}
	@Override
	public String toString()
	{
		return name;
	}
	@Override
	public int hashCode()
	{
		final int prime = 31;
		int result = 1;
		result = prime * result
				+ ((description == null) ? 0 : description.hashCode());
		result = prime * result + (favourite ? 1231 : 1237);
		result = prime * result + ((id == null) ? 0 : id.hashCode());
		result = prime * result
				+ ((identifier == null) ? 0 : identifier.hashCode());
		result = prime * result + ((name == null) ? 0 : name.hashCode());
		result = prime * result
				+ ((objectClassId == null) ? 0 : objectClassId.hashCode());
		result = prime * result
				+ ((objectClassName == null) ? 0 : objectClassName.hashCode());
		result = prime * result + (pickable ? 1231 : 1237);
		result = prime * result + (returnable ? 1231 : 1237);
		return result;
	}
	@Override
	public boolean equals(java.lang.Object obj)
	{
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Object other = (Object) obj;
		if (description == null)
		{
			if (other.description != null)
				return false;
		} else if (!description.equals(other.description))
			return false;
		if (favourite != other.favourite)
			return false;
		if (id == null)
		{
			if (other.id != null)
				return false;
		} else if (!id.equals(other.id))
			return false;
		if (identifier == null)
		{
			if (other.identifier != null)
				return false;
		} else if (!identifier.equals(other.identifier))
			return false;
		if (name == null)
		{
			if (other.name != null)
				return false;
		} else if (!name.equals(other.name))
			return false;
		if (objectClassId == null)
		{
			if (other.objectClassId != null)
				return false;
		} else if (!objectClassId.equals(other.objectClassId))
			return false;
		if (objectClassName == null)
		{
			if (other.objectClassName != null)
				return false;
		} else if (!objectClassName.equals(other.objectClassName))
			return false;
		if (pickable != other.pickable)
			return false;
		if (returnable != other.returnable)
			return false;
		return true;
	}
}

